package com.example.backend.config;

import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.stereotype.Component;

import java.time.Instant;
import java.util.HashMap;
import java.util.Map;

/**
 * 应用信息贡献者
 * 为Actuator提供自定义应用信息
 */
@Component
public class AppInfoContributor implements InfoContributor {

    @Override
    public void contribute(Info.Builder builder) {
        Map<String, Object> details = new HashMap<>();
        details.put("name", "客户反馈与工单管理系统");
        details.put("version", "1.0.0");
        details.put("description", "基于Spring Boot的客户反馈与工单管理系统后端API");
        details.put("author", "高级工程师");
        details.put("buildTime", Instant.now().toString());
        details.put("javaVersion", System.getProperty("java.version"));
        details.put("springBootVersion", "3.5.6");
        
        builder.withDetail("app", details);
    }
}
